<!-- 科室自取信息 -->

<template>
	<Card>
		<template #head>
			科室自取信息
		</template>
		<template #body>
			<view class="u-flex">
				<view class="u-flex-4">
					<CellItemDetail label="自取科室" :value="selfInfo.deptIdToName"></CellItemDetail>
					<CellItemDetail label="科室联系人" :value="Contact"></CellItemDetail>
				</view>
				<view class="u-flex-1  u-text-right">
					<HIcon icon="phone-fill" :block="false" @click="onCallPhone" type="fill" size="medium"></HIcon>
				</view>
			</view>
		</template>
	</Card>
</template>
<script>
	import Card from '@/components/card/components/cardDetail.vue'
	import CellItemDetail from '@/components/cell/itemDetail.vue'
	import HIcon from '@/components/button/circleIcon.vue'
	export default {
		props: {
			selfInfo: {
				type: Object,
				default: () => {
					return {}
				}
			}
		},
		computed: {
			Contact() {
				let { deptUser, phone } = this.selfInfo
				return `${deptUser || ''} ${phone || ''}`
			}
		},
		components: {
			Card,
			HIcon,
			CellItemDetail
		},
		methods: {
			onCallPhone() {

				if (this.selfInfo.phone) {
					wx.makePhoneCall({
						phoneNumber: this.selfInfo.phone
					})

				} else {
					wx.showToast({
						title: "电话为空",
						icon: 'error'
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>
